# @FileName  : file1.py
# @Time      : 2025/8/28 16:57
# @Author    : LuZhaoHui
# @Software  : PyCharm

# 扫描远程目录文件，jpg->pdf
from tool.ssh import *

ssh = sshClient('192.168.2.1', 22, 'root', 'Admin@2024', '/data/web')


for pos in range(19):
    path = '/data/web/scan-image-data/47.3-C-0%02d' % (pos + 1)
    print(path)
    dirs = ssh.getDir(path, isNest=True)
    # 读取文件
    files = ssh.getDirFile(path, True)

    for i, f in enumerate(files):
        if f in dirs:
            continue
        # 文件
        name = os.path.splitext(f)[0]
        ext = os.path.splitext(f)[1]
        if name[-1:] != 'A':
            continue
        fileA = '%s/%s' % (path, f)
        fileB = fileA.replace('A.jpg', 'B.jpg')
        ba = ssh.getFileByte(fileA)
        bb = ssh.getFileByte(fileB)
        if ba > bb:
            continue
        print(fileA)
